package com.agv.core.dao.dataExtractor;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;

import com.agv.core.objectDomain.InfoAuditoria;

public class InfoAuditoriaResultSetExtractor implements ResultSetExtractor {

	@Override
	public InfoAuditoria extractData(ResultSet rs) throws SQLException,
			DataAccessException {

		InfoAuditoria infoAuditoria = new InfoAuditoria();

		int count = 0;
		while (rs.next()) {
			if (count == 0) {
				infoAuditoria.setFhAlta(rs.getString("th"));
				infoAuditoria.setNbUsuarioAlta(rs.getString("nb_usuario"));
			} else {
				infoAuditoria.setFhMod(rs.getString("th"));
				infoAuditoria.setNbUsuarioMod(rs.getString("nb_usuario"));
			}
			count++;
		}

		return infoAuditoria;
	}
}
